<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<style>
    .class{
        background-color: red;
    }
</style>
<body>
    <div id = "app">
        <div v-for="(item,index) in dataList" @click="handclick(index)" :class="otto===index?'class':'' ">
            {{item}}
        </div>
    </div>

    <script>
        var vm = new Vue({
            el: "#app",
            data: {
                dataList:["首页","bbb","ccc"],
                otto:null
            },
            methods: {
                handclick(index){
                    this.otto = index
                }
            }
        })
    </script>
</body>
</html>